Page({
  onShareAppMessage() {
    return {
      title: '查看通行证',
      path: '/visitor_pkg/pages/passport/index',
      imageUrl: 'https://enjoy-plus.oss-cn-beijing.aliyuncs.com/images/share_poster.png',
    }
  },
  onLoad({id}) {
    console.log('进入了passport页面', id);
    this.getDetail(id)
  },
  async getDetail(id) {
    const res = await wx.http.get(`/visitor/${id}`)
    console.log(res);
    this.setData({...res.data})
  },
  async saveToLocal() {
    const res = await wx.getImageInfo({
      src: this.data.url,
    })
    console.log(res);
    wx.saveImageToPhotosAlbum({
      filePath: res.path,
    })
  }
})
